<?php

/**
 * Gallery View Album
 * 
 * @package Bd Gallery
 * @author Bebliuc George Cristian
 * @author Gianfranco Liporace
 * @copyright 2008-2010
 * @version 1.3
 * @access public
 * @permisions Modify, Redistribute but leave the credits alive :P
 * @use Noncommercial, for commercial use, please contact me at bebliuc.george@gmail.com, it's for free, but I need to know
 * 
 */
 
    $result_final = "";
    $settings = Plugin::getAllSettings('gallery');
    $image_url = URL_PUBLIC . "public/" . $settings['images_folder'];
    $photos = Photos::findAllByCategoryId($id);

    if (count($photos) > 0) {
        foreach($photos as $photo) {
            $result_array[] = "
            <div style='border:1px solid #CFCFCF; height:85px; width:110px; float:left; margin-left:10px; margin-bottom:20px;'>
                <div class=\"album_image{$photo->getId()}\" id=\"album_image\" style=\"background:url({$image_url}tb_{$photo->getFilename()}) no-repeat left top;\">
                    <div style=\"display: none;\">
                        <p style=\"album_p\"><strong>{$photo->getTitle()}</strong> <br /> <a href='".get_url('plugin/gallery/edit_photo')."/{$photo->getId()}'>". __('Edit') ."</a> | <a href='".get_url('plugin/gallery/delete_photo')."/{$photo->getId()}'>". __('Delete') ."</a></p>
                    </div>
                </div>
            </div>
            ";
        }

        foreach($result_array as $thumbnail_link) {
            $result_final .= $thumbnail_link;
        }
    } else {
        $result_final = "<h4>" . __('No photos is available in this album.') . "</h4>";
    }
    $category = Category::findById($id);
        
?>
<h1><?php echo __('Photos from'); ?> <?php echo $category->getName(); ?> </h1>
<br />
<?php echo $result_final; ?>
<script type="text/javascript" src="<?php echo GALLERY_ROOT; ?>/js/album.js"></script>
<script type="text/javascript">
<?php
foreach ($photos as $photo) {
?>
$(document).ready(function() {	
$('.album_p').widont();
// frog download box & description
$(".album_image<?php echo $photo->getId(); ?>").hover(function(){
$(".album_image<?php echo $photo->getId() ?> img").fadeIn(500);
$('.album_image<?php echo $photo->getId() ?> div').slideDown(400);
},function(){
$(".album_image<?php echo $photo->getId() ?> img").fadeOut(500);
$('.album_image<?php echo $photo->getId() ?> div').slideUp(200);
});
});
<?php } ?>
</script>
<div style="clear:both;"></div>
